package cn.tedu.project.oa.assessProject.controller;

import cn.tedu.project.oa.assessProject.pojo.entity.SystemMode;
import cn.tedu.project.oa.assessProject.service.ISystemModeService;
import cn.tedu.project.oa.base.response.JsonResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/oa/system/mode")
@Api(tags = "12.评分制度")
public class SystemModeController {
    @Autowired
    private ISystemModeService systemModeService;

    /**
     * 查询评分制度列表
     */
    @GetMapping("/list")
    public JsonResult list(SystemMode systemMode)
    {
        List<SystemMode> list = systemModeService.selectSystemModeList(systemMode);
        return JsonResult.ok(list);
    }

//    /**
//     * 导出评分制度列表
//     */
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, SystemMode systemMode)
//    {
//        List<SystemMode> list = systemModeService.selectSystemModeList(systemMode);
//        ExcelUtil<SystemMode> util = new ExcelUtil<SystemMode>(SystemMode.class);
//        util.exportExcel(response, list, "评分制度数据");
//    }

    /**
     * 获取评分制度详细信息
     */
    @GetMapping(value = "/{id}")
    public JsonResult getInfo(@PathVariable("id") Long id)
    {
        return JsonResult.ok(systemModeService.selectSystemModeById(id));
    }

    /**
     * 新增评分制度
     */
    @PostMapping
    public JsonResult add( SystemMode systemMode)
    {
        return JsonResult.ok(systemModeService.insertSystemMode(systemMode));
    }

    /**
     * 修改评分制度
     */
    @PutMapping
    public JsonResult edit( SystemMode systemMode)
    {
        return JsonResult.ok(systemModeService.updateSystemMode(systemMode));
    }

    /**
     * 删除评分制度
     */
    @DeleteMapping("/{ids}")
    public JsonResult remove(@PathVariable Long[] ids)
    {
        return JsonResult.ok(systemModeService.deleteSystemModeByIds(ids));
    }
}
